package com.ly.lw.styledo.ui;

import android.content.Intent;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Window;
import android.widget.ImageView;

import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.ly.lw.styledo.R;
import com.ly.lw.styledo.utils.MyAnimationDrawable;

public class GuideActivity extends FragmentActivity {
    @ViewInject(R.id.img2)
    private ImageView imageView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_guide);
        ViewUtils.inject(this);


       MyAnimationDrawable myAnimationDrawable = new MyAnimationDrawable(
               (AnimationDrawable) getResources().getDrawable(R.drawable.guide_activity)) {


           @Override
           protected void onAnimationEnd() {
               Intent intent;
               intent = new Intent(GuideActivity.this,MainActivity.class);
               finish();
               startActivity(intent);


           }
       };
        //imageView.setBackgroundResource(R.drawable.guide_activity);
       // iv.setBackgroundDrawable(mad);
        imageView.setBackgroundDrawable(myAnimationDrawable);
        //MyAnimationDrawable animationDrawable = (MyAnimationDrawable) imageView.getBackground();
        myAnimationDrawable.start();
    }



}
